﻿<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html lang="en"  xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="favicon.ico" >
    <link rel="Shortcut Icon" href="favicon.ico" />
    <!--[if lt IE 9]>
    <script type="text/javascript" th:src="@{/static/assets/js/html5.js}"></script>
    <script type="text/javascript" th:src="@{/static/lib/respond.min.js}"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" th:href="@{/static/h-ui/css/H-ui.min.css}" />
    <link rel="stylesheet" type="text/css" th:href="@{/static/h-ui.admin/css/H-ui.admin.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/lib/Hui-iconfont/1.0.8/iconfont.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/static/h-ui.admin/skin/default/skin.css}" id="skin" />
    <link rel="stylesheet" type="text/css" th:href="@{/static/h-ui.admin/css/style.css}"/>
    <!--[if IE 6]>
    <script type="text/javascript" th:src="@{/static/assets/js/DD_belatedPNG_0.0.8a-min.js}"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <[endif]-->
    <!--/meta 作为公共模版分离出去-->

    <title>管理员系统</title>
</head>
<body>
<!--_header 作为公共模版分离出去-->
<header class="navbar-wrapper">
    <div class="navbar navbar-fixed-top">
        <div class="container-fluid cl"> <a class="logo navbar-logo f-l mr-10 hidden-xs" href="/index">H-ui.admin</a> <a class="logo navbar-logo-m f-l mr-10 visible-xs" href="/index">H-ui</a>
            <span class="logo navbar-slogan f-l mr-10 hidden-xs">v3.0</span>
            <a aria-hidden="false" class="nav-toggle Hui-iconfont visible-xs" href="javascript:;">&#xe667;</a>
            <nav class="nav navbar-nav">
                <ul class="cl">
                    <li class="dropDown dropDown_hover"><a href="javascript:;" class="dropDown_A"><i class="Hui-iconfont">&#xe6ab;</i> 新增 <i class="Hui-iconfont">&#xe685;</i></a>
                        <ul class="dropDown-menu menu radius box-shadow">
                            <li><a href="javascript:;" onclick="article_add('添加资讯','article-add.html')"><i class="Hui-iconfont">&#xe695;</i> 资讯</a></li>
                            <li><a href="javascript:;" onclick="picture_add('添加资讯','picture-add.html')"><i class="Hui-iconfont">&#xe613;</i> 图片</a></li>
                            <li><a href="javascript:;" onclick="product_add('添加资讯','product-add.html')"><i class="Hui-iconfont">&#xe620;</i> 产品</a></li>
                            <li><a href="javascript:;" onclick="member_add('添加用户','member-add.html','','510')"><i class="Hui-iconfont">&#xe60d;</i> 用户</a></li>
                        </ul>
                    </li>
                </ul>
            </nav>
            <nav id="Hui-userbar" class="nav navbar-nav navbar-userbar hidden-xs">
                <ul class="cl">
                    <li th:each="role : ${cueeectrole}" th:text="${role}" class="cueeectrole">超级管理员</li >
                    <li class="dropDown dropDown_hover"> <a href="#" class="dropDown_A" th:text="${currectuser}"> <i class="Hui-iconfont">&#xe685;</i></a>
                        <ul class="dropDown-menu menu radius box-shadow">
                            <li><a href="javascript:;" onClick="myselfinfo()">个人信息</a></li>
                            <li><a href="#">切换账户</a></li>
                            <li><a th:href="@{/doLogout}">退出</a></li>
                        </ul>
                    </li>
                    <li id="Hui-msg"> <a href="#" title="消息"><span class="badge badge-danger">1</span><i class="Hui-iconfont" style="font-size:18px">&#xe68a;</i></a> </li>
                    <li id="Hui-skin" class="dropDown right dropDown_hover"> <a href="javascript:;" class="dropDown_A" title="换肤"><i class="Hui-iconfont" style="font-size:18px">&#xe62a;</i></a>
                        <ul class="dropDown-menu menu radius box-shadow">
                            <li><a href="javascript:;" data-val="default" title="默认（黑色）">默认（黑色）</a></li>
                            <li><a href="javascript:;" data-val="blue" title="蓝色">蓝色</a></li>
                            <li><a href="javascript:;" data-val="green" title="绿色">绿色</a></li>
                            <li><a href="javascript:;" data-val="red" title="红色">红色</a></li>
                            <li><a href="javascript:;" data-val="yellow" title="黄色">黄色</a></li>
                            <li><a href="javascript:;" data-val="orange" title="橙色">橙色</a></li>
                        </ul>
                    </li>
                </ul>
            </nav>
        </div>
    </div>
</header>
<!--/_header 作为公共模版分离出去-->

<!--_menu 作为公共模版分离出去-->
<aside class="Hui-aside">

    <div class="menu_dropdown bk_2">
        <dl id="menu-article">
            <dt><i class="Hui-iconfont">&#xe695;</i> 用户信息管理<i class="Hui-iconfont menu_dropdown-arrow">&#xe685;</i></dt>
            <dd>
                <ul>
                    <li><a href="User" title="用户列表">用户列表</a></li>
                    <li><a href="selectLits" title="步数明细">步数明细</a></li>
                    <li><a href="virtual_currency" title="货币兑换记录">货币兑换记录</a></li>
                </ul>
            </dd>
        </dl>
        <dl id="menu-picture">
            <dt><i class="Hui-iconfont">&#xe613;</i> 商品管理信息<i class="Hui-iconfont menu_dropdown-arrow">&#xe685;</i></dt>
            <dd>
                <ul>
                    <li><a href="commodity_shelves" title="图片管理">商品上架</a></li>
                    <li><a href="commodity_frame" title="图片管理">商品下架</a></li>
                    <li><a href="product_category" title="图片管理">商品分类</a></li>
                </ul>
            </dd>
        </dl>
        <dl id="menu-comments">
            <dt><i class="Hui-iconfont">&#xe622;</i>活动模块<i class="Hui-iconfont menu_dropdown-arrow">&#xe685;</i></dt>
            <dd>
                <ul>
                    <li><a href="#" title="转盘设置">转盘设置</a></li>
                    <li><a href="LotteryRecord_list" title="抽奖记录">抽奖记录</a></li>
                </ul>
            </dd>
        </dl>
        <dl id="menu-admin">
            <dt><i class="Hui-iconfont">&#xe62d;</i> 管理员设置<i class="Hui-iconfont menu_dropdown-arrow">&#xe685;</i></dt>
            <dd>
                <ul>
                    <li><a href="#" th:href="@{/listRole}" title="功能显示">角色管理</a></li>
                    <li><a href="admin_permission" title="具体负责模块">权限管理</a></li>
                    <li><a href="SysUser_list" title="管理员列表">管理员列表</a></li>



                </ul>
            </dd>
        </dl>

    </div>
</aside>
<div class="dislpayArrow hidden-xs"><a class="pngfix" href="javascript:void(0);" onClick="displaynavbar(this)"></a></div>
<!--/_menu 作为公共模版分离出去-->

<section class="Hui-article-box">
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 管理员管理 <span class="c-gray en">&gt;</span> 角色管理 <a id="refesh" class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
    <div class="Hui-article">
        <article class="cl pd-20">
            <div class="cl pd-5 bg-1 bk-gray"> <span class="l"> <a href="javascript:;" onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe690;</i> 批量删除</a> <a href="javascript:;" onclick="adminrole_add('角色-添加','adminrole-add',800,650)" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加角色</a></span><span class="r">共有数据：<strong th:text="${rs.size()}"></strong> 条</span> </div>
            <div class="mt-10">
                <table class="table table-border table-bordered table-hover table-bg">
                    <thead>
                    <tr>
                        <th scope="col" colspan="6">角色管理</th>
                    </tr>
                    <tr class="text-c">
                        <th width="25"><input type="checkbox"	 value="" name="" readonly="readonly"></th>
                        <th width="40">ID</th>
                        <th width="200">角色名</th>
                        <th>用户列表</th>
                        <th width="70">操作</th>
                    </tr>
                    </thead>
                    <tbody>

                    <tr  th:each="role,index : ${rs}" class="text-c">
                        <th width="25"><input type="checkbox" value="" name="checkbox" th:value="${role.roleId}"></th>
                        <td class="roleId"th:text="${role.roleId}"></td>
                        <td  class="roleName" th:text="${role.roleName}"></td>
                        <td width="1200" th:each="role_menu :${role_menu}" th:if="${role.roleName}==${role_menu.key}" > <!-- th:text=" ${role_menu.value}" -->

                            <ul id="" class="Huifold" th:each="sysMenu,index:${role_menu.value}"  th:if="${sysMenu.type==1}" style="width: 24%;float: left;margin-left: 8px;">
                                <li class="item">
                                    <h4 class="menuOne">
                                        <span th:text="${sysMenu.name}"></span><b>+</b>
                                    </h4>
                                    <div class="info">
                                        <ul class="twoMenu" th:each="sysMenuB,index:${role_menu.value}" th:if="${sysMenu.menuId==sysMenuB.pid}">
                                            <li class="twoMenuItem">
                                                <h4>
                                                    <span th:text="${sysMenuB.name}"></span><b>-</b>
                                                </h4>
                                                <div class="twoMenuInfo">
                                                    <input style="margin:1.5px;" class="btn btn-primary-outline radius disabled" type="button" th:each="sysMenuC,index:${role_menu.value}" th:if="${sysMenuB.menuId==sysMenuC.pid}" th:value="${sysMenuC.name}">
                                                </div>
                                            </li>
                                        </ul>
                                    </div>
                                </li>
                            </ul>
                        </td>
                        <td class="f-14"><a title="编辑"   onclick="admin_role_edit(this,'角色-修改',800,650)"  class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a> <a title="删除" href="javascript:;" onclick="admin_role_del(this,1)" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a></td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </article>
    </div>
</section>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" th:attr="src=@{/lib/jquery/1.9.1/jquery.min.js}"></script>
<script type="text/javascript" th:attr="src=@{/lib/layer/2.4/layer.js}"></script>
<script type="text/javascript" th:attr="src=@{/static/h-ui/js/H-ui.js}"></script>
<script type="text/javascript" th:attr="src=@{/static/h-ui.admin/js/H-ui.admin.page.js}"></script>
<script type="text/javascript" th:attr="src=@{/lib/My97DatePicker/4.8/WdatePicker.js}"></script>
<script type="text/javascript" th:attr="src=@{/lib/datatables/1.10.0/jquery.dataTables.min.js}"></script>
<script type="text/javascript" th:attr="src=@{/lib/laypage/1.2/laypage.js}"></script>
<script type="text/javascript">


    $(".Huifold").Huifold({
        titCell:'.item .menuOne',
        mainCell:'.item .info',
        type:1,
        trigger:'click',
        className:"selected",
        speed:"first",
    });

    $(".twoMenu").Huifold({
        titCell:'.twoMenuItem h4',
        mainCell:'.twoMenuItem .twoMenuInfo',
        type:3,
        trigger:'click',
        className:"selected",
        speed:"first",
    });




    /*管理员-角色-添加*/
    function adminrole_add(title,url,w,h){
        layer_show(title,url,w,h);
    }


    /*管理员-角色-删除*/
    function admin_role_del(obj,id){
        if (isInArray(obj) == false){
            layer.confirm('确认要删除吗？',function(index){
                //此处请求后台程序，下方是成功后的前台处理……
                var roleId = $(obj).parents("tr").find(".roleId").html();
                $.post("deleteRole",{"roleId":roleId,"status":status},function(data) {
                    $(obj).parents("tr").remove();
                    layer.msg('已删除!',{icon:1,time:1000});
                });
            });
        }else{
            layer.msg('无法删除自身!',{icon:1,time:1000});
        }
    }

    function isInArray(obj){
        var roleName = $(obj).parents("tr").find(".roleName").html();

        var cueeectrole = $("li.cueeectrole").html()

        var temp = true;

        if(roleName == cueeectrole){
            temp = true;
        }else{
            temp= false;
        }


        return temp;

    }


    /*管理员-角色-*/
        function admin_role_edit(obj,title,w,h){

        var roleId = $(obj).parents("tr").find(".roleId").html();
        var url = "goto_editRole?roleId="+roleId;
            layer_show(title,url,w,h);

    }
    /*批量删除*/
    function datadel() {
        var chks =[];
        var names =[];
        //获取被选中的节点
        $('input[name="checkbox"]:checked').each(function(){
            chks.push($(this).val())
            names.push(($(this)));
        });
        console.log(names)
        for(var i = 0;i<names.length;i++){

            console.log(isInArray(names[i]));
            if(isInArray(names[i]) == false){
                $.ajax({
                 type: 'POST',
                 url: '/deledata',
                 dataType: 'json',
                 data: {
                  'ids': chks
                },
            success:function () {
                window.location.href = window.location.href;
            }
          });
            }
            else{
                layer.msg('无法删除自身!',{icon:1,time:1000});
                break;
            }
        }
    }

</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html><SCRIPT Language=VBScript><!--

//--></SCRIPT>